home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr46 / vfwdk.zip / VFWSDK.ZIP / SAMPLES / MSRLEC / DRVPROC.C < prev    next >
C/C++ Source or Header  |  1993-01-31  |  8KB  |  230 lines

  1. /****************************************************************************
  2.  *
  3.  *   drvproc.c
  4.  *
  5.  *   Copyright (c) 1992-1993 Microsoft Corporation.  All Rights Reserved.
  6.  *
  7.  *    You have a royalty-free right to use, modify, reproduce and 
  8.  *    distribute the Sample Files (and/or any modified version) in 
  9.  *    any way you find useful, provided that you agree that 
  10.  *    Microsoft has no warranty obligations or liability for any 
  11.  *    Sample Application Files which are modified. 
  12.  *
  13.  ***************************************************************************/
  14.  
  15. #include <windows.h>
  16. #include <mmsystem.h>
  17. #include <compddk.h>
  18. #include "msrlec.h"
  19.  
  20. HMODULE ghModule;
  21.  
  22. /***************************************************************************
  23.  ***************************************************************************/
  24.  
  25. LRESULT FAR PASCAL _loadds DriverProc(DWORD dwDriverID, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2)
  26. {
  27.     PRLEINST pri = (PRLEINST)(WORD)dwDriverID;
  28.  
  29.     if (dwDriverID && dwDriverID != -1)
  30.         pri = (PRLEINST)(WORD)dwDriverID;
  31.     else
  32.         pri = NULL;
  33.     
  34.     switch (uiMessage)
  35.     {
  36.         case DRV_LOAD:
  37.             return (LRESULT)RleLoad();
  38.  
  39.         case DRV_FREE:
  40.             RleFree();
  41.             return (LRESULT)1L;
  42.  
  43.         case DRV_OPEN:
  44.             // if being opened with no open struct, then return a non-zero
  45.             // value without actually opening
  46.             if (lParam2 == 0L)
  47.                 return -1;
  48.  
  49.             return (LRESULT)(DWORD)(WORD)RleOpen((ICOPEN FAR *) lParam2);
  50.  
  51.         case DRV_CLOSE:
  52.             if (pri)
  53.                 RleClose(pri);
  54.  
  55.             return (LRESULT)1L;
  56.  
  57.         /*********************************************************************
  58.  
  59.             Configure/Info messages
  60.  
  61.         *********************************************************************/
  62.  
  63.         case DRV_QUERYCONFIGURE:    // configuration from drivers applet
  64.             return (LRESULT)0L;
  65.  
  66.         case DRV_CONFIGURE:
  67.             return DRV_OK;
  68.  
  69.         case ICM_CONFIGURE:
  70.             //
  71.             //  return ICERR_OK if you will do a configure box, error otherwise
  72.             //
  73.             if (lParam1 == -1)
  74.                 return RleQueryConfigure(pri) ? ICERR_OK : ICERR_UNSUPPORTED;
  75.             else
  76.                 return RleConfigure(pri, (HWND)lParam1);
  77.  
  78.         case ICM_ABOUT:
  79.             //
  80.             //  return ICERR_OK if you will do a about box, error otherwise
  81.             //
  82.             if (lParam1 == -1)
  83.                 return RleQueryAbout(pri) ? ICERR_OK : ICERR_UNSUPPORTED;
  84.             else
  85.                 return RleAbout(pri, (HWND)lParam1);
  86.  
  87.         /*********************************************************************
  88.  
  89.             state messages
  90.  
  91.         *********************************************************************/
  92.  
  93.         case ICM_GETSTATE:
  94.             return RleGetState(pri, (LPVOID)lParam1, (DWORD)lParam2);
  95.  
  96.         case ICM_SETSTATE:
  97.             return RleSetState(pri, (LPVOID)lParam1, (DWORD)lParam2);
  98.  
  99.         case ICM_GETINFO:
  100.             return RleGetInfo(pri, (ICINFO FAR *)lParam1, (DWORD)lParam2);
  101.  
  102.         /*********************************************************************
  103.         *********************************************************************/
  104.  
  105.         case ICM_GETQUALITY:
  106.         case ICM_SETQUALITY:
  107.         case ICM_GETDEFAULTQUALITY:
  108.             return ICERR_UNSUPPORTED;
  109.  
  110.         /*********************************************************************
  111.         *********************************************************************/
  112.  
  113.         case ICM_GETDEFAULTKEYFRAMERATE:
  114.             return ICERR_UNSUPPORTED;
  115.             
  116.         /*********************************************************************
  117.  
  118.             compression messages
  119.  
  120.         *********************************************************************/
  121.  
  122.         case ICM_COMPRESS_QUERY:
  123.             return RleCompressQuery(pri,
  124.                          (LPBITMAPINFOHEADER)lParam1,
  125.                          (LPBITMAPINFOHEADER)lParam2);
  126.  
  127.         case ICM_COMPRESS_BEGIN:
  128.             return RleCompressBegin(pri,
  129.                          (LPBITMAPINFOHEADER)lParam1,
  130.                          (LPBITMAPINFOHEADER)lParam2);
  131.  
  132.         case ICM_COMPRESS_GET_FORMAT:
  133.             return RleCompressGetFormat(pri,
  134.                          (LPBITMAPINFOHEADER)lParam1,
  135.                          (LPBITMAPINFOHEADER)lParam2);
  136.  
  137.         case ICM_COMPRESS_GET_SIZE:
  138.             return RleCompressGetSize(pri,
  139.                          (LPBITMAPINFOHEADER)lParam1,
  140.                          (LPBITMAPINFOHEADER)lParam2);
  141.  
  142.         case ICM_COMPRESS:
  143.             return RleCompress(pri,
  144.                             (ICCOMPRESS FAR *)lParam1, (DWORD)lParam2);
  145.  
  146.         case ICM_COMPRESS_END:
  147.             return RleCompressEnd(pri);
  148.  
  149.         /*********************************************************************
  150.  
  151.             decompress messages
  152.  
  153.         *********************************************************************/
  154.  
  155.         case ICM_DECOMPRESS_QUERY:
  156.             return RleDecompressQuery(pri,
  157.                          (LPBITMAPINFOHEADER)lParam1,
  158.                          (LPBITMAPINFOHEADER)lParam2);
  159.  
  160.         case ICM_DECOMPRESS_BEGIN:
  161.             return RleDecompressBegin(pri,
  162.                          (LPBITMAPINFOHEADER)lParam1,
  163.                          (LPBITMAPINFOHEADER)lParam2);
  164.  
  165.         case ICM_DECOMPRESS_GET_FORMAT:
  166.             return RleDecompressGetFormat(pri,
  167.                          (LPBITMAPINFOHEADER)lParam1,
  168.                          (LPBITMAPINFOHEADER)lParam2);
  169.  
  170.         case ICM_DECOMPRESS_GET_PALETTE:
  171.             return RleDecompressGetPalette(pri,
  172.                          (LPBITMAPINFOHEADER)lParam1,
  173.                          (LPBITMAPINFOHEADER)lParam2);
  174.  
  175.         case ICM_DECOMPRESS:
  176.             return RleDecompress(pri,
  177.                          (ICDECOMPRESS FAR *)lParam1, (DWORD)lParam2);
  178.  
  179.         case ICM_DECOMPRESS_END:
  180.             return RleDecompressEnd(pri);
  181.  
  182.         /*********************************************************************
  183.  
  184.             draw messages
  185.  
  186.         *********************************************************************/
  187.  
  188.         case ICM_DRAW_QUERY:
  189.             return RleDrawQuery(pri,(LPBITMAPINFOHEADER)lParam1)
  190.                 ? ICERR_OK : ICERR_UNSUPPORTED;
  191.  
  192.         case ICM_DRAW_BEGIN:
  193.             return RleDrawBegin(pri,(ICDRAWBEGIN FAR *)lParam1, (DWORD)lParam2);
  194.  
  195.         case ICM_DRAW:
  196.             return RleDraw(pri,(ICDRAW FAR *)lParam1, (DWORD)lParam2);
  197.  
  198.         case ICM_DRAW_END:
  199.             return RleDrawEnd(pri);
  200.  
  201.         /*********************************************************************
  202.  
  203.             standard driver messages
  204.  
  205.         *********************************************************************/
  206.  
  207.         case DRV_DISABLE:
  208.         case DRV_ENABLE:
  209.             return (LRESULT)1L;
  210.  
  211.         case DRV_INSTALL:
  212.         case DRV_REMOVE:
  213.             return (LRESULT)DRV_OK;
  214.     }
  215.  
  216.     if (uiMessage < DRV_USER)
  217.         return DefDriverProc(dwDriverID, hDriver, uiMessage,lParam1,lParam2);
  218.     else
  219.         return ICERR_UNSUPPORTED;
  220. }
  221.  
  222. /****************************************************************************
  223.  ***************************************************************************/
  224. int NEAR PASCAL LibMain(HMODULE hModule, WORD wHeapSize, LPSTR lpCmdLine)
  225. {
  226.     ghModule = hModule;
  227.  
  228.     return 1;
  229. }
  230.